<?php
include_once '../action/kuotaController.php';
include 'z_header.php';
if(!isset($_SESSION['nip'])){
    header('location:login.php');
}?>
<div class="container">  
    <div class="row">
<?php if(isset($_GET['view'])){
?>

<div class="span12 accordion-group">
<table class="table table-striped table-bordered">  
    <fieldset>  
        <legend>&nbsp;PENGATURAN KUOTA CUTI</legend>  
        <thead>  
          <tr>  
            <th width="300">Nama Bagian/Seksi</th>  
            <th width="300">Kuota</th>
            <th width="300">Atur Kuota</th>
          </tr>  
        </thead>  
        <tbody> 
         <?php 
            if($datakuota!=NULL){
                foreach($datakuota as $quota){
            ?>
          <tr>  
            <td><?php echo $quota->nm_seksi; ?></td> 
            <td><?php echo $quota->kuota; ?></td> 
            <td><a href="?ubah&id=<?php echo $quota->id_seksi; ?>"><i class="icon-edit" align="center" ></i></a></td>
          </tr> 
                <?php } 
            }?>   
        </tbody>  
        </fieldset>
      </table>
</div>
<?php } ?>

<?php
 if(isset($_GET['ubah'])){
     
     if(isset($error))
        {
                echo '<div class="alert alert-error" id="alert">'.$error.'
                      <button type="button" class="close" data-dismiss="alert" id="close">×</button></div>';
        }
     foreach ($kuota_ubah as $quota) {
?>
<div class="span7 offset2 accordion-group" id="form_ubahkuota">
    <div class="span6">
        <fieldset>
        <legend>PENGATURAN KANTOR</legend> 
    <form class="form-horizontal" method="post" action="#">
            <div class="control-group">  
                    <div class="controls">  
                        <input type="hidden" class="input-xlarge" name="id_seksi" value="<?php echo $quota->id_seksi;?>">
                    </div>  
            </div> 
            
            <div class="control-group">  
                  <label class="control-label" for="nm_seksi">Nama Bagian/Seksi</label>  
                      <div class="controls">   
                          <input class="input-xlarge" disabled name="nm_seksi" value="<?php echo $quota->nm_seksi; ?>">    
                      </div>  
            </div> 
            
           <div class="control-group">
                <label class="control-label" for="kuota">Kuota</label>
                        <div class="controls">
                            <select name="kuota" class="input-mini">
                            <?php
                                for($i=1;$i<=$max_kuota;$i++){
                                    if($quota->kuota==$i){
                                        echo "<option value=\"".$i."\" selected>".$i."</option>";
                                    }else{
                                        echo "<option value=\"".$i."\">".$i."</option>";
                                    }
                                }
                            ?>
                            </select>
                        </div>
            </div>

            <div class="form-actions"> 
                <a href="pengaturan.kuota.php?view" class="btn">Batal</a>
                <button type="submit" class="btn btn-primary" name="simpan_kuota" id="simpan_kuota">Simpan</button>  
            </div> 
        </fieldset>
    </form>  
</div>
</div>
     <?php }
 } ?>
<!--AKHIR FORM UBAH KUOTA -->                                           
<?php include_once 'z_footer.php'; ?>